package com.neusoft.neuiotms.common.model;

import java.util.List;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.validation.constraints.NotBlank;

import org.hibernate.annotations.LazyCollection;
import org.hibernate.annotations.LazyCollectionOption;
import org.hibernate.annotations.Proxy;
import org.hibernate.validator.constraints.Length;

import com.neusoft.bizcore.web.jpa.model.AbstractModel;
import com.neusoft.bizcore.web.jpa.model.Comment;

import lombok.Getter;
import lombok.Setter;
import lombok.ToString;

@Getter
@Setter
@ToString
@Entity
@org.hibernate.annotations.Table(appliesTo = "neuiot_dictionary_type", comment = "字典解释说明表")
@Table(name = "neuiot_dictionary_type")
@Proxy(lazy = false)
public class DictionaryType extends AbstractModel {

    private static final long serialVersionUID = 1L;

    /** 类型 */
    @NotBlank(message = "类型不能为空")
    @Length(max = 100, message = "类型不能超过{max}位")
    @Column(length = 100, nullable = false, unique = true)
    @Comment("varchar(100) NOT NULL COMMENT '类型'")
    private String type;

    /** 文本 */
    @NotBlank(message = "文本不能为空")
    @Length(max = 100, message = "文本不能超过{max}位")
    @Column(length = 100, nullable = false)
    @Comment("varchar(100) NOT NULL COMMENT '文本'")
    private String text;

    @OneToMany(mappedBy = "dictionaryType")
    @LazyCollection(LazyCollectionOption.FALSE)
    private List<Dictionary> dictionary;
}
